package guifiTest;

import java.net.InetAddress;
import java.net.UnknownHostException;

public class IP{
	String ip;
	boolean reachable;
	
	public IP(String p){
		ip=p;
		reachable=false;
	}
	public IP(String p, boolean r){
		ip=p;
		reachable=r;
	}
	public String getIP(){
		return ip;
	}
	public boolean getReachable(){
		return reachable;
	}
	public void setReachable(boolean state){
		reachable=state;
	}
	
	public void checkReachable(int timeOut){
		try {
			reachable=InetAddress.getByName(ip).isReachable(timeOut);
		} catch (UnknownHostException e) {
			reachable=false;
		} catch (Exception e) {
			e.printStackTrace();
			reachable=false;
		}
	}
}